import Cookies from 'js-cookie'

const UserKey = 'x-access-user';
const TokenKey = 'x-access-token';

// 120分钟，120 * 60 * 1000
const inFifteenMinutes = new Date(new Date().getTime() + 120 * 60 * 1000);

export function getUserCookies() {
    return Cookies.get(UserKey);
}

export function setUserCookies(user) {
    return Cookies.set(UserKey, user, {expires: inFifteenMinutes});
}

export function removeUserCookies() {
    return Cookies.remove(UserKey);
}

export function getTokenCookies() {
    return Cookies.get(TokenKey);
}

export function setTokenCookies(token) {
    return Cookies.set(TokenKey, token, {expires: inFifteenMinutes});
}

export function removeTokenCookies() {
    return Cookies.remove(TokenKey);
}